﻿<Application x:Class="TicTacToe.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             ShutdownMode="OnLastWindowClose" Startup="Application_Startup"
             Exit="Application_Exit" x:ClassModifier="internal">

    <Application.Resources>

        <Style x:Key="leftCornerButton" TargetType="{x:Type Button}">
            <Setter Property="BorderBrush" Value="DimGray" />
            <Setter Property="Background" Value="Black" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="Height" Value="23" />
            <Setter Property="BorderThickness">
                <Setter.Value>
                    <Thickness Left="0" Top="1.8" Bottom="0" Right="1.8" />
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border CornerRadius="0,23,0,0" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}">
                            <Viewbox Margin="3,3,9,3">
                                <ContentControl Foreground="{TemplateBinding Foreground}" 
                                                Content="{TemplateBinding Content}" />
                            </Viewbox>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderBrush.Color">
                                <ColorAnimation To="ForestGreen" Duration="0:0:0.6" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderBrush.Color">
                                <ColorAnimation To="DimGray" Duration="0:0:0.2" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.ExitActions>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="buttonStyleSimple" TargetType="{x:Type Button}">
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Background" Value="Black" />

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border Cursor="Hand" CornerRadius="5"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                            <ContentControl Foreground="White" 
                                            HorizontalAlignment="Center" 
                                            VerticalAlignment="Center"
                                            FontSize="{TemplateBinding FontSize}" 
                                            Content="{TemplateBinding Content}" />
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="buttonStyle" BasedOn="{StaticResource buttonStyleSimple}" TargetType="{x:Type Button}">
            <Setter Property="BorderBrush" Value="DimGray" />
            <Setter Property="BorderThickness" Value="1.5" />
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="BorderThickness" Value="2" />
                    <Setter Property="BorderBrush" Value="Tomato" />
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderThickness">
                                <ThicknessAnimation To="2" Duration="0:0:0.2" />
                            </Storyboard>
                        </BeginStoryboard>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderBrush.Color">
                                <ColorAnimation To="Tomato" Duration="0:0:0.4" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderThickness">
                                <ThicknessAnimation To="1.5" Duration="0:0:0.4" />
                            </Storyboard>
                        </BeginStoryboard>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderBrush.Color">
                                <ColorAnimation To="DimGray" Duration="0:0:0.4" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.ExitActions>
                </Trigger>
                <Trigger Property="IsMouseOver" Value="True">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderThickness">
                                <ThicknessAnimation To="3" Duration="0:0:0.2" />
                            </Storyboard>
                        </BeginStoryboard>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderBrush.Color">
                                <ColorAnimation To="ForestGreen" Duration="0:0:0.6"  />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderThickness">
                                <ThicknessAnimation To="1.5" Duration="0:0:0.2" />
                            </Storyboard>
                        </BeginStoryboard>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="BorderBrush.Color">
                                <ColorAnimation To="DimGray" Duration="0:0:0.2" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.ExitActions>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="borderStyle" TargetType="{x:Type Border}">
            <Setter Property="Background" Value="Black" />
            <Setter Property="CornerRadius" Value="5" />
        </Style>

        <Style x:Key="colorCBoxStyle" TargetType="{x:Type ComboBox}">
            <Setter Property="ItemsSource" Value="{Binding}" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Viewbox HorizontalAlignment="Center" VerticalAlignment="Center" >
                            <Border Height="20" Width="30" Margin="1" 
                                    CornerRadius="3" BorderThickness="0.8" 
                                    BorderBrush="Black" Background="{Binding}" />
                            <Viewbox.ToolTip>
                                <ToolTip Content="{Binding}" />
                            </Viewbox.ToolTip>
                        </Viewbox>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>

</Application>